from django.conf.urls import url
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token
from meiduo_admin.home import views
from meiduo_admin.user import user_views
from meiduo_admin.good import good_views, channels_views, brands_views

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    # ******************首页部分******************
    # 获取用户总数
    url(r'^statistical/total_count/$', views.UserTotalCountView.as_view()),
    # 获取日增用户数
    url(r'^statistical/day_increment/$', views.UserDayIncrementView.as_view()),
    # 获取日活用户数
    url(r'^statistical/day_active/$', views.UserDayActiveView.as_view()),
    # 获取下单用户数
    url(r'^statistical/day_orders/$', views.UserDayOrdersView.as_view()),
    # 获取月新增用户数
    url(r'^statistical/month_increment/$', views.UserMonthIncrementView.as_view()),
    # 获取商品分类日访问量
    url(r'^statistical/goods_day_views/$', views.UserGoodDayCountView.as_view()),
    # ******************用户管理部分******************
    # 用户管理页获取
    url(r'^users/$', user_views.UserView.as_view()),

    # sku管理页新增商品获取分类(三级分类)
    url(r'^skus/categories/$', good_views.SkuCategoriesView.as_view()),
    # sku管理页新增商品获取spu
    url(r'^goods/simple/$', good_views.GoodSimpleView.as_view()),
    # sku管理页新增商品获取规格选项
    url(r'^goods/(?P<spu_id>\d+)/specs/$', good_views.GoodsIdSpecView.as_view()),
    # 频道管理获取频道组 goods/channel_types/
    url(r'^goods/channel_types/$', channels_views.GoodsChannelsTypesView.as_view()),
    # 频道管里页获取一级分类 goods/categories/
    url(r'^goods/categories/$', channels_views.GoodsCategoriesView.as_view()),
]

# ******************商品管理部分******************
# SKU管理页获取
route = DefaultRouter()
route.register(r'skus', good_views.SkuViewSet, base_name='skus')
urlpatterns += route.urls

# 频道管理 goods/channels/
route = DefaultRouter()
route.register(r'goods/channels', channels_views.GoodsChannelsView, base_name='goods_channels')
urlpatterns += route.urls

# 品牌管理 goods/brands/
route = DefaultRouter()
route.register(r'goods/brands', brands_views.GoodsBrandsView, base_name='goods_brands')
urlpatterns += route.urls
